package com.com.effectivejava.generalprogramming;

import java.util.logging.Logger;

/**
 * Created by User on 09/07/2014.
 */
public class StringUses {
    static Logger logger = Logger.getLogger(StringUses.class.getName());

    static {
        logger.setParent(Logger.getLogger(StringUses.class.getPackage().getName()));
    }

    public static void main(String[] args) {

        String a = "HelloWorld";
        String b = a.substring(0, 5);

        logger.info("a.substring(0, 5): "+ b);
        logger.info("a.substring(0): "+ a.substring(0));

        // special case: beginindex is equal to the length of the string.
        logger.info("a.substring(10): "+ a.substring(10));
        logger.info("a.substring(10,10): " + a.substring(10, 10));

        logger.info("a.substring(0,10): "+ a.substring(0,10));

        //Now it throws an exception.
        //logger.info("a.substring(11): "+ a.substring(11));

        logger.info("a.substring(4,4): " + a.substring(4, 4));










    }
}
